﻿using System.Configuration;
using Vtron.ATSP.DataAccess;
using Vtron.ATSP.Infrastructure;
using Vtron.ATSP.Projector;
using Vtron.ATSP.Tester;

namespace Vtron.ATSP.BusinessLogic
{
    public sealed class ScreenTestHandlerFactory
    {
        private static readonly ScreenTestHandlerFactory instance = new ScreenTestHandlerFactory();
        public static ScreenTestHandlerFactory Instance
        {
            get
            {
                return instance;
            }
        }

        private ScreenTestHandlerFactory()
        {
            IProjectorCom IProjectorCom = ReflectionFactory.CreateObject<IProjectorCom>(ConfigurationManager.AppSettings["IProjectorCom"]);
            ISerialCom ISerialCom = ReflectionFactory.CreateObject<ISerialCom>(ConfigurationManager.AppSettings["ISerialCom"]);
            IPersistence IPersistence = ReflectionFactory.CreateObject<IPersistence>(ConfigurationManager.AppSettings["IPersistence"]);

            screenTestHandler = new ScreenTestHandler(IProjectorCom, ISerialCom, IPersistence);
        }

        private readonly ScreenTestHandler screenTestHandler;
        public ScreenTestHandler ScreenTestHandler
        {
            get
            {
                return screenTestHandler;
            }
        }
    }
}
